=begin
  DESCRIPTION:
  Start and stop a simple localhost server on any development folder.

  USAGE:
    1. Drop 'server.rb' into a directory. 
    2. Open a cmd/terminal and CD.. to that directory, run the command:
    > ruby webrick.rb
=end

  
  require 'webrick'
  include WEBrick
  
  dir = Dir::pwd
  port = 12000 + (dir.hash % 1000)
  puts "URL: http://localhost:#{port}"
  s = HTTPServer.new(:Port => port, :DocumentRoot => dir)
  trap("INT"){ s.shutdown }
  s.start
  
  
  